icon-view: emit selection-changed when changing the model
authorWilliam Jon McCann <jmccann@redhat.com>
Fri, 10 Aug 2012 17:23:20 +0000 (13:23 -0400)
committerWilliam Jon McCann <jmccann@redhat.com>
Mon, 20 Aug 2012 17:59:09 +0000 (13:59 -0400)
Only if there was a selection active.

https://bugzilla.gnome.org/show_bug.cgi?id=681613

gtk/gtkiconview.c

index 3da42aecaae7df0617204d3af492a51e5c6c646c..8740f46836de78ede24ed5533a490cebe6622366 100644 (file)
@@ -4901,6 +4901,8 @@ void
 gtk_icon_view_set_model (GtkIconView *icon_view,
                         GtkTreeModel *model)
 {
+  gboolean dirty;
+
   g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
   g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model));
   
@@ -4917,6 +4919,8 @@ gtk_icon_view_set_model (GtkIconView *icon_view,
   if (icon_view->priv->cell_area)
     gtk_cell_area_stop_editing (icon_view->priv->cell_area, TRUE);
 
+  dirty = gtk_icon_view_unselect_all_internal (icon_view);
+
   if (model)
     {
       GType column_type;
@@ -5001,6 +5005,9 @@ gtk_icon_view_set_model (GtkIconView *icon_view,
 
   g_object_notify (G_OBJECT (icon_view), "model");  
 
+  if (dirty)
+    g_signal_emit (icon_view, icon_view_signals[SELECTION_CHANGED], 0);
+
   gtk_widget_queue_resize (GTK_WIDGET (icon_view));
 }